package cn.getech.data.development.constant;

import lombok.Getter;

/**
 * 任务类型的枚举
 *
 * @author zenith
 */
@Getter
public enum JobType {


    START(0, "开始","Start"),
    INPUT(1, "数据接入","Accessdata"),
    SQL(2, "SQL计算","Sqlcompute"),
    PROC(3, "程序执行", ""),
    OUTPUT(4, "数据推送", "Output"),
    END(5, "结束", "End"),
    SHELL(6, "shell任务","Shelldata"),
    ALGORITHM(7, "算法任务","Algorithm"),
    ;

    int code;
    String name;
    String enName;

    JobType(int code, String message, String enName) {
        this.code = code;
        this.name = message;
        this.enName = enName;
    }

    public static JobType ObjOf(Integer code) {
        if (code == null) {
            return null;
        } else {
            for (JobType s : JobType.values()) {
                if (s.getCode() == code) {
                    return s;
                }
            }
            return null;
        }
    }
    public static Boolean ObjOf(String name) {
        if (name == null) {
            return false;
        } else {
            for (JobType s : JobType.values()) {
                if (s.getEnName().equals(name)) {
                    return true;
                }
            }
            return false;
        }
    }
}
